package 设计模式.结构型.decorate装饰器.Demo_1.domain.Decorator;

import 设计模式.结构型.decorate装饰器.Demo_1.domain.service.IBaseCount;
import 设计模式.结构型.decorate装饰器.Demo_1.domain.OrderDetail;

import java.math.BigDecimal;

/**
 * 计算支付金额的抽象类
 *
 * @author admin
 */
public abstract class BaseCountDecorator implements IBaseCount {

    private IBaseCount count;

    public BaseCountDecorator(IBaseCount count) {
        this.count = count;
    }

    /**
     * 原价计算
     *
     * @param orderDetail 订单详情
     * @return 原价
     */
    public BigDecimal countPayMoney(OrderDetail orderDetail) {
        BigDecimal payTotalMoney = new BigDecimal(0);
        if (count != null) {
            payTotalMoney = count.countPayMoney(orderDetail);
        }
        return payTotalMoney;
    }
}